﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="List.ascx.vb" Inherits="Control_HolidayCalendar_List" %>
<script type='text/javascript'>
    function ajaxJquery() {
        $(function () {
            $("#<%=txtDate.ClientID %>").datepicker({ dateFormat: 'dd/mm/yy' });

            // register thickbox after postback
            var isAsyncPostback = Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
            if (isAsyncPostback) {
                tb_init('a.thickbox, area.thickbox, input.thickbox');
            }

        });
    }

    function confirmMultiDelete(strID) {
        $("#<%= hidDel.ClientId  %>").val('1');
        var grdShow = document.getElementById("<%=grdShow.ClientID %>");
        var count = 0;
        for (i = 1; i < grdShow.children.item(0).children.length; i++) {
            if (grdShow.children.item(0).children.item(i).children.item(0).children.item(0).checked) {
                count += 1;
            }
        }
        if (count > 0) {
            return ComfirmDialog('<%=drpMessage.Items(1).Text%>', 0, strID, 0, 0);
        } else {
            Alertbox('<%=drpMessage.Items(2).Text%>');
            return false;
        }
    }
    function ComfirmDialog(strText, value, ObjectIdClick, ID, Type) {
        $("#<%= hidDel.ClientId  %>").val('1');
        if (value == 0) {
            Confirmbox(strText, value, ObjectIdClick, ID, Type);
            return false;
        } else {
            if (Type == 1) {
                document.getElementById('<%=hidID.ClientID %>').value = ID;
                eval($("#" + ObjectIdClick + "").attr("href"));
            }
            else {
                $("#" + ObjectIdClick + "").click();
            }
        }
    }

    function CheckValidData(source, arguments) {
        var obj = $("#<%=hidDel.ClientId %>").val();
        if (obj == "1") {
            arguments.IsValid = true;
            return true;
        }
        else {
            if ($("#<%= txtDate.ClientId %>").val() == "") {
                arguments.IsValid = false;
                return false;
            }
            else
                return true;
        }
    }
</script>
<asp:UpdatePanel ID="uplHolidaycalendar" runat="server">
    <ContentTemplate>
        <div class="content_porletform">
            <div class="HeadTitle">
                <h3>
                    QUẢN LÝ NGÀY NGHỈ</h3>
            </div>
            <div class="box_contentform">

                <div class="DivRequired">
                    <span class="fieldRequired">&nbsp;</span>Trường yêu cầu nhập dữ liệu
                </div>
                <div class="Error">
                    <asp:ValidationSummary ID="ValidationSummary2" runat="server" ForeColor="#FF3300" />
                </div>
            
            <div class="DivRow">
                <div class="DivLabel">
                    <asp:Label ID="lblDate" CssClass="TextLabel" runat="server" Text="Ngày:" /> <span class="fieldRequired">&nbsp;</span>
                </div>
                <div class="DivTextBox">
                    <asp:TextBox ID="txtDate" CssClass="TextBox" runat="server" Text="" /><span style="font-family: Arial,tahoma;
                        font-size: 10pt; font-weight: normal;">(dd/mm/yyyy)</span>
                    <asp:CustomValidator ID="CustomValidator3" runat="server" ErrorMessage="Vui lòng nhập ngày nghỉ." 
                    ClientValidationFunction="CheckValidData" Display="None" SetFocusOnError="True"></asp:CustomValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txtDate"
                        Display="None" ErrorMessage="Ngày nhập không đúng định dạng" ValidationExpression="^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$"></asp:RegularExpressionValidator>
                </div>
            </div>
            <div class="DivRow">
                <div class="DivLabel">
                    <asp:Label ID="lblNote" CssClass="TextLabel" runat="server" Text="Ghi chú:" />
                </div>
                <div class="DivTextBox">
                    <asp:TextBox ID="txtNote" CssClass="TextBox" runat="server" Text="" />
                </div>
            </div>
            <div class="DivRow">
                  <div class="DivLabel">
                    &nbsp;
                  </div>
                <div class="DivTextBox">
                    <asp:Button ID="btnSave" runat="server" Text=" Lưu " CssClass="btn" />
                    <asp:Button ID="btnHuy" CausesValidation="false" runat="server" Text=" Hủy " CssClass="btn" />&nbsp;
                </div>
            </div>
        </div>
        <br />
        <div style="display: none">
            <asp:HiddenField ID="hidIDEdit" Value="0" runat="server" />
        </div>
        <div class="SubjectTitle">
            Năm: 
            <asp:DropDownList runat="server" AutoPostBack="true" ID="ddlYearSearch">
            </asp:DropDownList> &nbsp;
            <asp:Button ID="btnSatSunGen" runat="server" Text="Tạo ngày nghỉ" 
                CssClass="btn" CausesValidation="False" />
            </div>

        <asp:GridView ID="grdShow" runat="server" AutoGenerateColumns="False" EmptyDataText="{Không có dữ liệu}"
            AllowPaging="false" Width='100%' BorderWidth="1px" CssClass="GridBorder">
            <Columns>
                <asp:TemplateField>
                    <HeaderTemplate>
                        <asp:CheckBox ID="CheckAll" runat="server" onclick="CheckAll(this);" Width="30px" />
                    </HeaderTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemTemplate>
                        <asp:CheckBox ID="chkItem" runat="server" />
                    </ItemTemplate>
                    <ItemStyle Width="5%" HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:HyperLink ID="hplEdit" runat="server" Text="Sửa"></asp:HyperLink>&nbsp;|&nbsp;
                        <asp:LinkButton ID="lnkbtnDelete" Text="Xóa" runat="server" OnClick="lnkbtnDelete_Click"
                            CausesValidation='False'></asp:LinkButton>
                    </ItemTemplate>
                    <ItemStyle CssClass="GridTextLink" HorizontalAlign="Center" Width="10%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="STT">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblSTT" Text=''></asp:Label>
                    </ItemTemplate>
                    <ItemStyle Width="5%" HorizontalAlign="Left" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText='Ngày'>
                    <ItemTemplate>
                        <asp:Label ID="lblDate" runat="server"></asp:Label>
                    </ItemTemplate>
                    <ItemStyle Width='10%' CssClass='text_list_links' HorizontalAlign='Left' />
                </asp:TemplateField>
                 <asp:TemplateField HeaderText='Thứ'>
                    <ItemTemplate>
                        <asp:Label ID="lblDateOfWeek" runat="server"></asp:Label>
                    </ItemTemplate>
                    <ItemStyle Width='10%' CssClass='text_list_links' HorizontalAlign='Left' />
                </asp:TemplateField>

                <asp:BoundField DataField='Note' HeaderText='Ghi Chú'>
                    <ItemStyle Width='20%' />
                </asp:BoundField>
            </Columns>
            <HeaderStyle Height="26px" HorizontalAlign="Left" CssClass="GridHeader" />
            <RowStyle CssClass="GridRow" Height="23px" />
            <AlternatingRowStyle CssClass="GridAlterRow" />
            <PagerStyle CssClass="GridPaged" HorizontalAlign="Right" Height="23px" />
            <PagerSettings Mode="Numeric" PageButtonCount="2" />
            <EmptyDataRowStyle CssClass="GridTextEmpty" HorizontalAlign="Center" />
        </asp:GridView>
        <div>
            <asp:Button ID="btnDelete" CssClass="btn" runat="server" Text="Xóa" CausesValidation="false" />
            <asp:Label ID="lblPage_Size" runat="server" Text="Số bản ghi trên trang:"></asp:Label>
            <asp:DropDownList ID="drpPage_Size" runat="server" AutoPostBack="True" Width="70px"
                CssClass="input_form">
                <asp:ListItem Text="10" Value="10"></asp:ListItem>
                <asp:ListItem Text="20" Value="20"></asp:ListItem>
                <asp:ListItem Text="50" Value="50"></asp:ListItem>
                <asp:ListItem Text="100" Value="100"></asp:ListItem>
            </asp:DropDownList>
            <asp:Label ID="lblTotal" runat="server"></asp:Label></div>
        <div style="width: 100%">
            <!--phan trang-->
            <div id="results_resultsNavigationDiv" class="paginationEMP">
                <ul>
                    <asp:LinkButton ID="lnkFirst" runat="server"></asp:LinkButton>
                    <asp:Repeater ID="rptPage" runat="server">
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkTitle" CssClass="page_num" runat="server" OnClick="lnkTitle_Click" CausesValidation="false"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:Repeater>
                    <asp:LinkButton ID="lnkLast" runat="server"></asp:LinkButton>
                </ul>
            </div>
            <asp:HiddenField ID="hidCount" Value="0" runat="server" />
            <asp:HiddenField ID="hidIndex_page" Value="0" runat="server" />
            <asp:HiddenField ID="hidCur_Page" Value="1" runat="server" />
        </div>
        <div style='display: none'>
            <asp:DropDownList ID="drpMessage" runat="server">
                <asp:ListItem Text='Bạn có chắc chắn muốn xóa bản ghi này không?' Value='0'></asp:ListItem>
                <asp:ListItem Text='Bạn có chắc chắn muốn xóa bản đã chọn?' Value='1'></asp:ListItem>
                <asp:ListItem Text='Bạn phải chọn ít nhất một bản ghi.' Value='2'></asp:ListItem>
            </asp:DropDownList>
            <asp:HiddenField ID="hidID" Value="0" runat="server" />
            <asp:HiddenField ID="hidDel" Value="0" runat="server" />
        </div>
</div>

    </ContentTemplate>
</asp:UpdatePanel>
